#ifndef	OLED_DISPLAY_H
#define	OLED_DISPLAY_H

/* -------- SSD1306 display -------- */
#define	OLED_WIDTH		128
#define	OLED_HEIGHT		64
#define	VBUFFER_SIZE	1024

//#define	DC_Data				true
//#define	DC_DisplayCommand	false

#define	SETCONTRAST			0x81
#define	DISPLAYALLON_RESUME	0xA4
#define	DISPLAYALLON		0xA5
#define	NORMALDISPLAY		0xA6
#define	INVERTDISPLAY		0xA7
#define	DISPLAYOFF			0xAE
#define	DISPLAYON			0xAF
#define	SETDISPLAYOFFSET	0xD3
#define	SETCOMPINS			0xDA
#define	SETVCOMDETECT		0xDB
#define	SETDISPLAYCLOCKDIV	0xD5
#define	SETPRECHARGE		0xD9
#define	SETMULTIPLEX		0xA8
#define	SETLOWCOLUMN		0x00
#define	SETHIGHCOLUMN		0x10
#define	SETSTARTLINE		0x40
#define	MEMORYMODE			0x20
#define	COMSCANINC			0xC0
#define	COMSCANDEC			0xC8
#define	SEGREMAP			0xA0
#define	CHARGEPUMP			0x8D

typedef	enum {
	eExternalVcc = 1,
	eSwitchCapVcc = 2,
} eVccType;

typedef	enum {
	eNormalDisplay,
	eInvertDisplay
} eDisplayType;

typedef enum {
	eBlack,
	eWhite
} eOLEDColor;
		
/* SSD1306 display functions */
void oled_initialize( eVccType vccType );
void oled_close( void );
void oled_invertDisplay( eDisplayType eDisplay );
void oled_clearScreen( void );
void oled_refresh( void );
void oled_setPixel( portSHORT x, portSHORT y, eOLEDColor color );
void oled_drawRectangle(portSHORT x, portSHORT y, portSHORT w, portSHORT h, eOLEDColor color);
void oled_drawBitmap(portSHORT x, portSHORT y, portCHAR* bitmap, portSHORT w, portSHORT h, eOLEDColor color);
void oled_putChar(portCHAR c);
void oled_drawChar(portSHORT x, portSHORT line, portCHAR c);
void oled_drawString(portSHORT x, portSHORT line, portCHAR* str, portSHORT size);
void oled_demoDisplayText( void );
void oled_demoLogo( void );

#endif	/* OLED_DISPLAY_H */